package cn.hgd11.jts.util;

import org.locationtech.jts.geom.GeometryFactory;
import org.locationtech.jts.geom.LineString;
import org.locationtech.jts.geom.Point;
import org.locationtech.jts.geom.PrecisionModel;
import org.locationtech.jts.io.ParseException;
import org.locationtech.jts.io.WKTReader;

public class GeometryUtils {

    public static final GeometryFactory GF = new GeometryFactory(new PrecisionModel(), 4326);

    public static LineString lineStringFromWkt(String wkt) throws ParseException {
        WKTReader reader = new WKTReader(GF);
        return (LineString) reader.read(wkt);
    }

    public static Point pointFromWkt(String wkt) throws ParseException {
        WKTReader reader = new WKTReader(GF);
        return (Point) reader.read(wkt);
    }
}
